
require.config({
    paths: {
        Zepto:  '../libs/zepto/zepto-loader',
        underscore: '../libs/underscore/underscore-loader',
        Backbone: '../libs/backbone/backbone-loader',
        order: '../libs/require/order-1.0.5',
        text: '../libs/require/text-1.0.6',
        async: '../libs/require/async',
        PhoneGap: '../libs/phonegap/phonegap-loader',
        Handlebars: '../libs/handlebars/Handlebars',
        mobiscroll: '../libs/mobiscroll/mobiscroll-2.0.custom.min',
        templates: '../templates'
    },

    shim: {
        mobiscroll: ['Zepto']
    }
});

require(['order!Zepto'], function($) {

	require(['underscore', 'Backbone', 'router'], function(_, Backbone, AppRouter) {
        
        document.addEventListener("deviceready", run, false);
        
        
        //////////////////////
        function onDeviceReady() {
        	alert('ciao');
            navigator.geolocation.getCurrentPosition(onSuccess, onError);
        }

        function onSuccess(position) {
            var element = document.getElementById('geolocation');
            alert('Longitude: '          + position.coords.longitude);
        }

        function onError(error) {
            alert('code: '    + error.code    + '\n' +
                  'message: ' + error.message + '\n');
        }
    
        function run() {
            app = new AppRouter();
            Backbone.history.start();
        }
        ///////////////////////////
    })
});

